import Vue from 'vue'
import { requst, requst2, requst3, requst4, requst5, requst6, requst7 } from '@/http/request.js'
import { getUInfo, timestampToDateFormat } from '@/util/util.js'


// 登录 
Vue.prototype.$login = (prms) => {
	return requst('/api/user/login', prms, 'POST', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 查询运单  
Vue.prototype.$getOrder = (prms) => {
	return requst('/api/user/getOrder', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 异常原因 
Vue.prototype.$getReason = (prms) => {
	return requst('/api/index/getReason', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 上报异常
Vue.prototype.$uploadAbnormal = (prms) => {
	return requst('/api/user/abnormal', prms, 'POST', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 历史记录 
Vue.prototype.$getAbnormal = (prms) => {
	return requst('/api/user/getAbnormal', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 删除异常记录 
Vue.prototype.$delAbnormal = (prms) => {
	return requst('/api/user/delAbnormal', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 上传回单 
Vue.prototype.$uploadHd = (prms) => {
	return requst('/api/user/receipt', prms, 'POST', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 回单列表 
Vue.prototype.$getHdList = (prms) => {
	return requst('/api/user/getReceipt', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 删除回单 
Vue.prototype.$delReceipt = (prms) => {
	return requst('/api/user/delReceipt', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 数据统计 
Vue.prototype.$getStatistics = (prms) => {
	return requst('/api/user/statistics', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 获取回单详情 
Vue.prototype.$getReceipt = (prms) => {
	return requst('/api/index/getReceipt', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}


/* ********** ruizhen图片识别 ********** */
// 识别文字+表格
Vue.prototype.$fetchPicTableWord = (prms) => {
	return requst2('/v1/table_words/fetch', prms, 'POST', { 'content-type': 'application/x-www-form-urlencoded' })
}
// 识别文字
Vue.prototype.$fetchPicWord = (prms) => {
	return requst2('/v1/general/fetch', prms, 'POST', { 'content-type': 'application/x-www-form-urlencoded' })
}
// 识别表格
Vue.prototype.$fetchPicTable = (prms) => {
	return requst2('/v1/table/fetch', prms, 'POST', { 'content-type': 'application/x-www-form-urlencoded' })
}


/* ********** deepseek图片识别 ********** */
/**
curl -X POST https://api.deepseek.com/vision/analyze \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"image_url": "https://example.com/image.jpg"}'
 */
Vue.prototype.$dsAnalyze = (prms) => {
	return requst3('/vision/analyze', prms, 'POST', { 'content-type': 'application/json', 'Authorization': 'Bearer sk-f949a9e9119b47c285ed1ee5a605ffd3' })
}

Vue.prototype.$dsChatCompletions = (prms) => {
	return requst3('/chat/completions', prms, 'POST', { 'content-type': 'application/json', 'Authorization': 'Bearer sk-f949a9e9119b47c285ed1ee5a605ffd3' })
}

/* ********** 火山引擎(豆包AI) ********** */
Vue.prototype.$arkAnalyze = (prms) => {
	return requst5('/api/v3/chat/completions', prms, 'POST', { 'content-type': 'application/json', 'Authorization': 'Bearer c7d3f0d6-7999-4389-8018-a735e04c85fa' })
}

/* ********** 火山引擎(豆包AI)生产环境接口 ********** */
Vue.prototype.$arkAnalyze2 = (prms) => {
	return requst5('/api/index/completions', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

/* ********** 互亿验证码 ********** */
// 发送语音
Vue.prototype.$sendVoiceCode = (prms) => {
	return requst4('/webservice/voice.php?method=Submit', prms, 'POST', { 'content-type': 'application/x-www-form-urlencoded' })
}

/* ********** 致胜OA ********** */
// 物品列表
Vue.prototype.$getGoodsList = (prms) => {
	return requst6('/api.php', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 提交物品领用
Vue.prototype.$postGoodsList = (prms) => {
	return requst6('/api.php', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 退押金申请 
Vue.prototype.$postGoodsRequisition = (prms) => {
	return requst6('/api.php', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}

/* ********** 致胜展会项目专用:部分功能共用异常上报项目 ********** */
// 核销
Vue.prototype.$postHexiao = (prms) => {
	return requst('/api/user/writeOff', prms, 'POST', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 手机号姓名核销 
Vue.prototype.$postHexiao2 = (prms) => {
	return requst('/api/user/write', prms, 'POST', { 'content-type': 'application/x-www-form-urlencoded' })
}

// 核销记录
Vue.prototype.$getHexiaoList = (prms) => {
	return requst('/api/user/writeList', prms, 'GET', { 'content-type': 'application/x-www-form-urlencoded' })
}